﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GenericLibrariesToolKit;

namespace Model
{
    /// <summary>
    /// 专家实体
    /// </summary>
    public class Expert
    {
        /*专家ID*/
        public string ExpertId { get; set; }
        /*名*/
        public string ExpertFirstName { get; set; }
        /*姓*/
        public string ExpertLastName { get; set; }
        /*电话号码*/
        public string ExpertPhone { get; set; }
        /*住址*/
        public string ExpertAddress { get; set; }
        /*所在城市*/
        public string ExpertCity { get; set; }
        /*email*/
        public string ExpertEmail { get; set; }
        /*所在州/省*/
        public string ExpertState { get; set; }
        /*邮政编码*/
        public string ExpertPostalCode { get; set; }
        /*专家类型*/
        public string ExpertType { get; set; }
        /*自我介绍*/
        public string ExpertIntroduce { get; set; }
        /*点击量*/
        public long ExpertClickAmount { get; set; }


        /// <summary>
        /// 应用程序启动时，实体管理器将会调用此方法进行初始化。
        /// </summary>
        public void Intialization()
        {
            //声明一个实体实体对象
            Entity entity = new Entity();

            //指定该实体对应数据库中的表名
            entity.TableName = "T_EXPERT";
            //指定该实体的标识符
            entity.EntityId = "ExpertId";
            //指定主键生成策略
            entity.Generator = GenericLibrariesToolKit.Enumeration.PKGenerationStrategy.USER_INPUT;
            ///实体关系映射字典
            ///key:实体属性名称，value:对应的数据库中表的字段名
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            dictionary.Add("ExpertId", "EXPERT_ID");
            dictionary.Add("ExpertFirstName", "EXPERT_FIRST_NAME");
            dictionary.Add("ExpertLastName", "EXPERT_LAST_NAME");
            dictionary.Add("ExpertPhone", "EXPERT_PHONE");
            dictionary.Add("ExpertAddress", "EXPERT_ADDRESS");
            dictionary.Add("ExpertCity", "EXPERT_CITY");
            dictionary.Add("ExpertEmail", "EXPERT_EMAIL");
            dictionary.Add("ExpertState", "EXPERT_STATE");
            dictionary.Add("ExpertPostalCode", "EXPERT_POSTAL_CODE");
            dictionary.Add("ExpertType", "EXPERT_TYPE");
            dictionary.Add("ExpertIntroduce", "EXPERT_INTRODUCE");
            dictionary.Add("ExpertClickAmount", "EXPERT_CLICK_AMOUNT");

            //赋值
            entity.ORMDictionary = dictionary;

            //将实体加入实体管理器，
            EntityManager.GetInsatnce().AddEntity("Model.Expert", entity);
        }

    }
}
